Orangutan X2 Mega168 Firmware v1.01 Release Notes:



Fixed a bug on the 168 that would occasionally cause the status byte to show that the buzzer was done before it really was.  This would happen if a buzzer interrupt occurred in just the right place after an SPI interrupt but before the main loop section that started the buzzer playing.


Fixed a bug in setting the brake duration.  This command now functions correctly.  As a result, a wrapper for this command was added to the sample SPI command wrapper code SPI.c.


Fixed a bug in setting the current limit and proportional PID constant P.  This command now functions correctly.  As a result, a wrapper for this command was added to the sample SPI command wrapper code SPI.c.


Revised the buzzer code to eliminate popping sounds that could happen at the start of notes when the volume was low.


Added safeguards to protect the mega168 in the case that the user writes bad values to any of the EEPROM settings addresses.  Most settings can safely have any 8-bit value with the following exceptions:

* the number of current sense samples to average must be a power of two
* motor P values must be 7-bit (<= 127) to ensure the P calculation doesn't result in an integer overflow
* the number of UART-read-ready-bytes must be in the range of 1 - 32.  A value of zero will just keep the read-ready flag set constantly and a value greater than 32 will mean the read-ready flag is never set.
* the buzzer volume must be a 4-bit value (0 - 15)

Now the mega168 can gracefully handle having an invalid setting saved to its EEPROM.


Changed the programmer code to prevent AVRDUDE from being able to change the mega644's low fuse byte.  This fuse byte determines the mega644 clock settings.  The mega644 outputs the 20MHz clock used by the mega168, so it is crucial that the user not be able change these clock fuse bits.


Improved the UART settings code so that the mega644 no longer has to wait at least 50us before sending UART data after setting UART parameters.  The mega168 will now buffer data sent by the mega644 until the UART configuration is complete.  In version 1.00, the UART could potentially try transmitting data sent by the mega644 before the configuration process was complete.  As a result of this change, the delay was removed from setSerial function in the sample SPI command wrapper code SPI.c.


Improved the mega168 EEPROM code so that it is aware of queued EEPROM writes.  In version 1.00, the mega168 was only able to tell if it was currently writing to EEPROM, which meant polling to see if the EEPROM was busy could return false negatives if the poll was conducted between queued EEPROM writes (or before a requested EEPROM write was carried out).  To get around this, the mega644 would have to make sure the mega168's EEPROM remained writable for some short duration before it could safely request an EEPROM read or write.  Now the mega644 can safely request an EEPROM read or write upon receiving a single confirmation that the mega168's EEPROM is not busy.  As a result, the 300us delay has been removed from waitWhileEEPROMBusy() in the sample SPI command wrapper code SPI.C.  The waitWhileEEPROMBusy() function has now been rewritten as a #define.


Changed the way the mega168 handles current control.  Now current control is applied in the same manner as acceleration, which means that the proportional PID constant P is now ten times less potent.  Changed default values for P from 5 to 50.


Changed ADC so that it shuts down the motors only when current > current limit.  In version 1.00, when proportional PID constant P was set to zero, the motor would shut down when current >= current limit.


Reading the UART error byte will now clear the UART error bit in the status byte.


Added a read-buffer underrun error bit to UART error byte.  This bit is set if the mega644 ever tries to read a byte from the mega168's UART read buffer while it is empty.